[Universal Links] Link does not open the order if the link store is already selected in the app #8425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #8423
Description
When opening an order universal link from a store that is already chosen and visible in the app, it navigates to the orders tab but doesn't open the order details. When it has to switch sites, i.e the link is pointing to an order of a user's site that is not selected in the app, it works correctly.
The reason behind this is that we were returning
falseon theswitchToStorecompletion callback because it actually didn't switch sites, as the site was already there. Once we got that, we took it as if the app failed to switch to the order's site innavigateToOrderDetails, thus not showing the order's details.To fix it, I rename the
switchToStorefunction inMainTabBarControllertoshowStore, to make it more meaningful -we want to show the site, we don't care if we had to switch sites or it was present already- and return true if the the site was already shown.Testing instructions
blog_id= your site id that is selected in the app andorder_id= an order of that site. Add that link to your email or notes app as shown in the video.Result: The app is opened and navigates to the Orders tab but the order details screen is not shown
Expected Result: It should show the Order Details
Screenshots
Buggy behavior
RPReplay_Final1671124934.MP4
Fixed behavior
RPReplay_Final1671124853.MP4
RELEASE-NOTES.txtif necessary.